import java.security.MessageDigest;


public class HashUtils {

    /**
     * getting SHA1 hash value of a byte array
     * @param content
     * @return
     */
    public static String getHashOfByteArray(byte[] content) throws Exception{
        MessageDigest complete = MessageDigest.getInstance("SHA-1");
        complete.update(content);
        byte[] sha1 = complete.digest();

        String hashValue = "";
        for(int j = 0; j < sha1.length; j++) {
            hashValue += Integer.toString((sha1[j]>>4)&0x0F, 16) + Integer.toString(sha1[j]&0x0F, 16);
        }
        return hashValue;
    }

}
